<?php
/**
 * Created by PhpStorm.
 * User: lx
 * Date: 2019/12/28
 * Time: 9:18
 */
namespace app\api\controller;

use app\util\ReturnCode;
use think\cache\driver\Redis;
use think\facade\App;
use \think\Request;
use app\command\controller\Testing;
use app\model\mt_user;
use app\command\controller\Generate;

/**
 * Class User
 * @package app\api\controller
 * 小程序用户主类
 */
class User extends Testing
{
    public function __construct(){
        parent::__construct();
    }
    /**
     * 获取用户详情
     * @return mixed
     */
    public function getUserInfo(){
        print_r(date("YmdHi"));die;
        $openID = $this->request->get("openID");
        if(!$openID){
            return $this->error(ReturnCode::EMPTY_PARAMS,"openID 参数为空");
        }
        $obj = new mt_user();
        $userInfo = $obj->get(["openID" => $openID]);
        if($userInfo){
            $this->userInfo = $userInfo;
            return $this->success("查询成功",$userInfo);
        }else{
            return $this->error(ReturnCode::RECORD_NOT_FOUND,"记录未找到");
        }
    }
}